<html>
<head>
    <meta charset="utf-8">
    <link rel="stylesheet" type="text/css" href="css/index.css">
    <link rel="stylesheet" href="css/swiper.min.css">
    <script type="text/javascript" src="js/jquery-1.8.3.min.js"></script>
    <link rel="stylesheet" type="text/css" href="css/animate.css">
    <link rel="stylesheet" type="text/css" href="css/aos.css">
    <!-- 头部样式开始 -->
    <link rel="stylesheet" type="text/css" href="plug/bootstrap/3.3.0/css/bootstrap.min.css">
    <link rel="stylesheet" type="text/css" href="css/nav.css">
    <link rel="stylesheet" href="/manage/plugin/font-awesome-4.6.3/css/font-awesome.min.css">
    <script type="text/javascript" src="plug/jquery/1.11.1/jquery.min.js"></script>
    <script type="text/javascript" src="plug/bootstrap/3.3.0/js/bootstrap.min.js"></script>
    <!-- 头部样式结束 -->
    <script type="text/javascript" src="js/jquery.scrollify.js"></script>
    <script type="text/javascript" src="js/masonry.pkgd.min.js"></script>
    <script type="text/javascript" src="js/imagesloaded.pkgd.min.js"></script>
    <script src="js/layer/layer.js"></script>
    <style type="text/css">
        .panel{
            margin: 0;
        }
        a:hover{text-decoration: none;}
    </style>
</head>
<bady>
    <div class="container">
        <div class="row" style="margin: 10px">
            <form action="{{ url('submit') }}" method="POST" enctype="multipart/form-data">
                {{ csrf_field() }}
                <div class="form-group">
                    <div class="input-group">
                        <div class="input-group-addon"><i class="icon-user-md"></i></div>
                        <input type="text" name="name" class="form-control" id="exampleInputEmail1" placeholder="您的名字">
                    </div>
                </div>
                <div class="form-group">
                    <div class="input-group">
                        <div class="input-group-addon"><i class="icon-hospital"></i></div>
                        <input type="text" name="company" class="form-control" id="exampleInputEmail1" placeholder="您的公司">
                    </div>
                </div>
                <div class="form-group">
                    <label for="exampleInputPassword1"></label>
                    <div class="input-group">
                        <div class="input-group-addon"><i class="icon-phone"></i></div>
                        <input type="text" name="phone" class="form-control" id="exampleInputPassword1" placeholder="手机号码">
                    </div>
                </div>
                <div class="form-group">
                    <label for="exampleInputFile"></label>
                    <div class="input-group">
                        <div class="input-group-addon"><i class="icon-pencil"></i></div>
                        <select name="project" class="form-control">
                            <option>需求项目</option>
                            @foreach($project as $value)
                                <option value="{{ $value['id'] }}">{{ $value['project'] }}</option>
                            @endforeach
                        </select>
                    </div>
                </div>
                <div class="form-group">
                    <label for="exampleInputPassword1"></label>
                    <textarea rows="15" name="message" placeholder="请留下您的信息，30分钟内会有专业的品牌顾问联系您!" style="width: 100%"></textarea>
                </div>
                <div style="position: absolute;right: 35px;bottom: 80px;"><p style="color:#7b7a74">*为了您的权益，您的隐私将被严格保密。</p></div>
                <button type="submit" class="btn btn-default" style="width: 100%;box-shadow:0px 15px 15px -15px #d9d9d9; background-image: url(./image/but.jpg);">立刻咨询</button>
                <div class="form-group"><i class="fa fa-users"></i> 已有<span style="color:#f00">{{ $total }}</span>名客户进行了品牌顾问咨询!</div>
            </form>
        </div>

    </div>
</bady>
<script>
    $(function () {
        $("form").submit(function(event) {
            event.preventDefault();
            var url = $(this).attr('action');
            $.ajaxSetup({
                headers: {
                    'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
                }
            });
            $.ajax({
                url:url,
                data:$("form").serialize(),
                async:false,
                type:"POST",
                dateType:'json',
                success:function(res){
                    console.log(res);
                    var res = eval("("+res+")");
                    console.log(res);
                    if(res.code == 100){
                        layer.msg(res.msg,{time:1500, icon:6, end:function(){location.reload();}});
//                        window.location.href=window.location.href;
//                        window.location.reload();
                    }else{
                        layer.msg(res.msg);
                    }
                }
            });
        });
    });

</script>
</html>